<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height  + 'rem' }">
    

    <div class="list">
        <img class="heard-left" :src="publicUrls + 'free/style3/displayBoardStyle5Bg1.webp'" alt="" />
      <div class="item-parent" v-for="(item, index) in props.info.showpieceList" :key="index">
        <div @contextmenu.stop="emit('onContextMenuChild', $event, index)" class="item">
          <div class="img-box" @click="viewImg(item.moduleId, item.id)">
            <img
              class="cover"
              v-lazy="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')"
              alt=""
              @click="viewImg(item.moduleId, item.id)"
            />
            <div class="flower-btn">
              <div></div>
            </div>
          </div>
          <div
            class="items-title"
            :style="{
              'background-image': `url(${publicUrls + 'free/style3/displayBoardStyle5Bg3.webp'})`,
            }"
          >
            <span>{{ item.name }}</span>
          </div>
        </div> 
      </div>
      <img
      class="heard-right"
      :src="publicUrls + 'free/style3/displayBoardStyle5Bg2.webp'"
      alt=""
    />
    </div>
    
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'style1',
});
</script>

<script setup lang="ts">
import { urls, getLinkUrl } from '@/utils/request/upload';
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { defineComponent } from 'vue';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});
const emitChildItemDraggable = (draggingInfo: any, childIndex: number) => {
  emit('emitChildItemDraggable', draggingInfo, childIndex); //分组传递当前展品图距离相对父元素的xy偏移量变化
};
const emitChildItemDraggableStyle = (draggingInfo: any, childIndex: number) => {
  emit('emitChildItemDraggableStyle', draggingInfo, childIndex); //分组设置当前展品图距离相对父元素的宽高变化
};
const emitShowcaseDraggable = (draggingInfo: any) => {
  emit('emitShowcaseDraggable', draggingInfo); //传递当前展柜图距离相对父元素的xy偏移量变化
};
const emitShowcaseDraggableStyle = (draggingInfo: any) => {
  emit('emitShowcaseDraggableStyle', draggingInfo); //传递当前展柜距离相对父元素的宽高变化
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
const getIndex = (index) => {
  const num = ['壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '拾'];
  if (index + 1 <= 10) {
    return num[index];
  } else {
    let num1 = index % 10; //小数部分
    let num2 = Math.floor(index / 10); //整数部分
    return num[num2 - 1 === 0 ? 9 : num2 - 1] + num[num1];
  }
};
const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );

//
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  z-index: 999;
  padding: 0px !important;
    
  -webkit-box-reflect: below 25% linear-gradient(transparent, rgba(0, 0, 0, 0.2));
}

.heard-left {
  width: 193px;
  height: 386px;
}
.heard-right {
  width: 201px;
  height: 386px;
}

.list {
    width: 100%;
  display: flex;
  height: 386px;
}
.item-parent {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 386px;
  height: 386px;
}
.item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 386px;
  height: 386px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background: #e1dbcf;
}

.active {
  :deep(.flot-menu) {
    display: flex;
    z-index: 99999;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}
.items-title {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 386px;
  height: 49px;
  padding: 10px 40px;
  //   overflow: hidden;
  //   text-overflow: ellipsis;
  //   white-space: nowrap;
  //   width: 198px;
  //   height: 28px;
  //   font-family: SourceHanSerifCN-Bold;
  //   font-size: 18px;
  //   color: #ece5d9;
  //   line-height: 28px;
  //   text-align: center;
  //   margin-top: 55px;
  span { 
    width: 306px; 
    height: 28px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: SourceHanSerifCN-Bold;
    font-size: 18px;
    color: #ece5d9;
    text-align: center;
    line-height: 28px;
  }
}
.img-box {
    position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border: 1px solid #623333;
  width: 386px;
  height: 337px;
}
.cover {
  width: 386px;
  height: 337px;
  object-fit: contain;
  transition: all 0.3s;
}
.img-box:hover {
  .cover {
    transform: scale(1.1);
  }
}
.flower-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.3);
  border: 3px solid #ffffff;
  border-radius: 50%;
  display: none;
  div {
    width: 12.5px;
    height: 12.5px;
    background: #ffffff;
    border-radius: 50%;
  }
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: flower 2s linear infinite;
  @keyframes flower {
    0% {
      opacity: 0;
    }
    40% {
      opacity: 100%;
    }
    80% {
      opacity: 100%;
    }
    100% {
      opacity: 0;
    }
  }
}
</style>
